package fun.chutianshu.eescore_03_web_api.controller;

import fun.chutianshu.eescore_03_web_api.dao.StudentDao;
import fun.chutianshu.eescore_03_web_api.entity.Student;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags="学生信息api")
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    StudentDao studentDao;

    @ApiOperation("返回所有学生")
    @GetMapping("/stu_list")
    @CrossOrigin
    public List<Student> index(ModelMap map) {
        List<Student> studentList = studentDao.getAllStudents();
        return studentList;
    }
}
